package com.hantang.devops.appgenerator.core.engine;

import java.util.ArrayList;
import java.util.List;

public class CodeGenerateChain {
	private int successorNum;
	
	public List<CodeGenerateHandler> handlers=new ArrayList<CodeGenerateHandler>();
	
	public void addHandlers(CodeGenerateHandler handler){
		this.handlers.add(handler);
	}
	
	public void executeCodeGenerate(CodeGenerateRequest request,CodeGenerateResponse result){
		if(successorNum < handlers.size()){
			this.handlers.get(successorNum++).doCodeGenerate(request, result, this);
		}
	}
}
